// Copyright (C) ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
//
// $Id: text.hpp 210 2008-08-28 10:10:41Z heavyzheng $
//

#ifndef ZZHENG_XML_DOM_LIBXML2_TEXT_HPP_20080717__
#define ZZHENG_XML_DOM_LIBXML2_TEXT_HPP_20080717__

#include <zzheng/xml/config.hpp>
#include <zzheng/xml/dom/libxml2/child_node.hpp>
#include <zzheng/xml/dom/libxml2/callbacks.hpp>
#include <zzheng/xml/dom/libxml2/libxml2_fwd.hpp>

#include <string>

#ifdef ZZHENG_MSVC
#  pragma warning(push)
#  pragma warning(disable: 4511 4512) // noncopyable warnings
#endif // ZZHENG_MSVC

namespace zzheng {
namespace xml {
namespace dom {
namespace libxml2_ {

    //! This class represents an XML text or CData section.
    class text: public child_node {

        friend void on_node_construct(xmlNode* px);

    public:

        //! Destructor.
        ~text();

        //! Checks if this node is a CData section.
        //! \return true if this node is a CData section, false otherwise.
        bool is_cdata() const;

        //! Returns the value of this text or CData section.
        //! \return the value of this text or CData section.
        std::string value() const;

        //! Sets the value of this text or CData section.
        //! \param value  the value to set.
        void set_value(const std::string& value);

    private:

        explicit text(xmlNode* px);

        text* clone(bool recursive) const;

    }; // class text

} // namespace zzheng::xml::dom::libxml2_
} // namespace zzheng::xml::dom
} // namespace zzheng::xml
} // namespace zzheng

#ifdef ZZHENG_MSVC
#  pragma warning(pop) // noncopyable warnings
#endif // ZZHENG_MSVC


#endif // ZZHENG_XML_DOM_LIBXML2_TEXT_HPP_20080717__



